var  fs=require("fs")
var path=require("path")
var targetDir="E:\\project\\yunpingtai\\escondida\\src\\main\\kotlin\\com\\sytech\\escondida\\entity";
function firstSmall(name) {
    return name[0].toLocaleLowerCase()+name.substring(1)
}
fs.readdir(targetDir,function (err,files) {
    var names=[]
    var apis=[]
    var routes=[]
    var menus=[]
    for(var i in files){
        var file=files[i]
        var name=path.basename(file,".kt")
        name=firstSmall(name)
        names.push(firstSmall(name))
        apis.push(" "+name+": `${APIV1}/"+name+"/`")
        routes.push(" {\n" +
            "      path: '/"+name+"',\n" +
            "      models: () => [import('./models/"+name+"')],\n" +
            "      component: () => import('./routes/"+name+"/'),\n" +
            "    }")
        menus.push("{\n" +
            "    name: '"+name+"',\n" +
            "    icon: 'inbox',\n" +
            "    route: '/"+name+"',\n" +
            "    remark: '',\n" +
            "  }")

    }
    console.log(  names.join(","))
    //生成api路径
    console.log(apis.join(",\n"))
    //生成路由
    console.log(routes.join(",\n"))
    console.log(menus.join(",\n"))
})